#include "Kernel_PCH.h"
#include "Mutex.h"

/*--------------------------------------------------------------------------*/

Mutex::Mutex() :
	m_mutex(NULL)
{
	
}

/*--------------------------------------------------------------------------*/

Mutex::~Mutex()
{
	if (m_mutex)
	{
		SDL_DestroyMutex(m_mutex);
	}
}

/*--------------------------------------------------------------------------*/

void Mutex::Lock()
{
	if (m_mutex == NULL)
	{
		m_mutex = SDL_CreateMutex();
	}

	if (m_mutex)
	{
		SDL_LockMutex(m_mutex);
	}
}

/*--------------------------------------------------------------------------*/

void Mutex::Unlock()
{
	if (m_mutex)
	{
		SDL_UnlockMutex(m_mutex);
	}
}

/*--------------------------------------------------------------------------*/
